package mvc.controller;

import org.springframework.stereotype.Component;
import org.springframework.web.HttpRequestHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * * 声明controller的第二种方式
 * * 实现Controller接口
 * * 不同实现Controller的方式需要不同的适配器来执行method
 * * 所以需要寻找springmvc执行过程中需要寻找适配器
 * * dispatcherServlet里面handlerMapping就两种类型
 *
 * @Author:ChenZhangKun
 * @Date: 2021/5/9 15:02
 */
@Component("/nzq")
public class ExtendsRequestHandlerController implements HttpRequestHandler {

    @Override
    public void handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws ServletException, IOException {
        System.out.println("通过实现HttpRequestHandler定义controller");
    }
}
